package com.cos.hospital.ui.other;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.cos.hospital.R;
import com.cos.hospital.tool.glide.UGlide;

import uk.co.senab.photoview.PhotoView;

/**
 * 图片浏览
 */
public class TuPianItemFragment extends Fragment {
    private static final String ARG_PARAM1 = "param1";

    private String url;
    PhotoView photoView;

    public TuPianItemFragment() {
        // Required empty public constructor
    }

    /**
     *
     */
    public static Fragment newInstance(String url) {
        TuPianItemFragment fragment = new TuPianItemFragment();
        Bundle args = new Bundle();
        args.putString(ARG_PARAM1, url);
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (getArguments() != null) {
            url = getArguments().getString(ARG_PARAM1);
        }
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_tu_pian_item, container, false);
        photoView = view.findViewById(R.id.picture);
        UGlide.loadPop(getContext(), url, photoView);
        return view;
    }

}
